package com.ums.upos.service;

import android.os.RemoteException;

import com.nexgo.oaf.apiv3.device.led.LightModeEnum;
import com.ums.upos.GlobalDataHolder;
import com.ums.upos.uapi.device.led.LEDDriver;
import com.ums.upos.uapi.device.led.LEDLightConstrants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * LED灯服务类
 */
public class LEDBinder extends LEDDriver.Stub {
    private final String TAG = "LEDService";
    private Logger log;
    private com.nexgo.oaf.apiv3.device.led.LEDDriver sdkLEDDriver;

    LEDBinder() {
        log = LoggerFactory.getLogger(TAG);
        sdkLEDDriver = GlobalDataHolder.getInstance().getDeviceEngine().getLEDDriver();
    }

    @Override
    public void setLed(int light, boolean isOn) throws RemoteException {
        log.info("call setLed {},{}", light, isOn);
        switch (light) {
            case LEDLightConstrants.RED:
                sdkLEDDriver.setLed(LightModeEnum.RED, isOn);
                break;
            case LEDLightConstrants.BLUE:
                sdkLEDDriver.setLed(LightModeEnum.BLUE, isOn);
                break;
            case LEDLightConstrants.GREEN:
                sdkLEDDriver.setLed(LightModeEnum.GREEN, isOn);
                break;
            case LEDLightConstrants.YELLOW:
                sdkLEDDriver.setLed(LightModeEnum.YELLOW, isOn);
                break;
        }
    }
}